package edu.xust.controller;

import com.alibaba.fastjson.JSON;
import edu.xust.pojo.Story;
import edu.xust.service.RoleService;
import edu.xust.service.SectionOneService;
import edu.xust.service.SectionTwoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/sectionTwo")
public class SectionTwoController {
    @Autowired
    SectionTwoService sectionService;
    @Autowired
    RoleService roleService;

    @RequestMapping(value = "/par02", produces = "application/json;charset=utf-8")
    @ResponseBody
    public String patOne(int id) {
        Story part = sectionService.getPart(id);
        roleService.update(id,part,2);//更新剧情
        String s = JSON.toJSONString(part);
        return s;
    }
}
